package com.situ.crm2026.model;

import com.baomidou.mybatisplus.annotation.*;
import com.situ.crm2026.util.AuditEntity;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Pattern;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.time.LocalDate;
import java.util.List;

/*
 * 会员
 * */
@TableName("t_member")
@Getter
@Setter
public class Member extends AuditEntity implements Serializable {
    @TableId(type=IdType.AUTO)
    private Integer id;

    @NotBlank(message = "会员名称不能为空")
    @TableField(condition = SqlCondition.LIKE,whereStrategy = FieldStrategy.NOT_EMPTY)
    private String name;
    //@TableField("mobile")


    @Pattern(regexp = "^\\d{11}$",message = "手机号格式不正确")
    @NotBlank(message = "手机号不能为空")
    @TableField(condition = SqlCondition.LIKE,whereStrategy = FieldStrategy.NOT_EMPTY)
    private String phone;
    private String password;
    private String pinyin;

    @NotBlank(message = "会员性别不能为空")
    @Pattern(regexp = "^[男,女]$",message = "会员性别格式错误")
    @TableField(whereStrategy = FieldStrategy.NOT_EMPTY)
    private String sex;
    private LocalDate birthday;
    @TableField(condition = SqlCondition.LIKE,whereStrategy = FieldStrategy.NOT_EMPTY)
    private String email;
    @TableField(condition = SqlCondition.LIKE,whereStrategy = FieldStrategy.NOT_EMPTY)
    private String wechat;
    private String description;
    //头像
    @TableField("portrait")
    private String avatar;

    @TableField(exist = false)
    private List<MemberCourseReservation> reservations;


}
